{extend name="property/public/insidePageBase" /}
{block name="title"}基本信息{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">系 统 名 称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" value="{$info['name'] ?? ''}" lay-verify="required" placeholder="请输入系统名称"  class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">客 服 电 话</label>
                    <div class="layui-input-inline">
                        <input type="text" name="service_tel" value="{$info['service_tel']??''}" lay-verify="require" autocomplete="off" placeholder="请输入客服电话" class="layui-input">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">系统LOGO</label>
                <div class="layui-input-inline" style="width: 275px;">
                    <input type="text" name="items_logo" value="{$info['items_logo'] ?? ''}"  placeholder="请上传系统LOGO" id="items_logo" class="layui-input">
                </div>
                <img src="{$info['items_logo'] ?? ''}" class="checkPictureByImg items_logo" style="width: 80px;height: 40px;">
                <div class="layui-input-inline layui-btn-container" style="width: auto;">
                    <button type="button" class="layui-btn layui-btn-primary uploadImg" lay-data="{field: 'items_logo',data:{dir:'items/logo', field:'items_logo'}}">
                        <i class="layui-icon">&#xe67c;</i>上传LOGO
                    </button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">系统 ICON</label>
                <div class="layui-input-inline" style="width: 275px;">
                    <input type="text" name="items_icon" value="{$info['items_icon'] ?? ''}"  placeholder="请上传系统ICON图标" id="items_icon" class="layui-input">
                </div>
                <img src="{$info['items_icon'] ?? ''}" class="checkPictureByImg items_icon" style="width: 80px;height: 40px;">
                <div class="layui-input-inline layui-btn-container" style="width: auto;">
                    <button type="button" class="layui-btn layui-btn-primary uploadImg" lay-data="{field: 'items_icon',data:{dir:'items/icon', field:'items_icon'}}">
                        <i class="layui-icon">&#xe67c;</i>上传ICO图
                    </button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">微信公众号</label>
                <div class="layui-input-inline" style="width: 275px;">
                    <input type="text" name="wechat_code" value="{$info['wechat_code'] ?? ''}"  placeholder="请上传微信公众号二维码" id="wechat_code" class="layui-input">
                </div>
                <img src="{$info['wechat_code'] ?? ''}" class="checkPictureByImg wechat_code" style="width: 80px;height: 40px;">
                <div class="layui-input-inline layui-btn-container" style="width: auto;">
                    <button type="button" class="layui-btn layui-btn-primary uploadImg" lay-data="{field: 'wechat_code',data:{dir:'items/wechat', field:'wechat_code'}}">
                        <i class="layui-icon">&#xe67c;</i>上传二维码
                    </button>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">官 方 微 信</label>
                    <div class="layui-input-block">
                        <input type="text" name="wechat" value="{$info['wechat'] ?? ''}" placeholder="请输入官方微信" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">公 司 邮 箱</label>
                    <div class="layui-input-inline">
                        <input type="text" name="email" value="{$info['email'] ?? ''}" placeholder="请输入公司邮箱" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">官 方 网 址</label>
                <div class="layui-input-block">
                    <input type="text" name="website" value="{$info['website'] ?? ''}" placeholder="请输入官方网址" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">公 司 地 址</label>
                <div class="layui-input-block">
                    <input type="text" name="address" value="{$info['address'] ?? ''}" placeholder="请输入公司地址" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block">
                    <textarea name="copyright" class="layui-textarea">{$info['copyright'] ?? ''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="setting">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['layer', 'form'], function () {
        let form = layui.form;
        form.on('submit(setting)', function (data) {
            var field = data.field;
            var loadAdd = layer.msg('提交中', {icon: 16, time: 0, shade: 0.1, offset: '15px'});
            $.post("{:url('propertyConfigUpdate')}", field, function (res) {
                layer.close(loadAdd);
                if (res.code === 0) {
                    location.reload()
                    layer.msg(res.msg, {icon: 6, offset: '15px'});
                } else {
                    layer.msg(res.msg, {icon: 5, offset: '15px'});
                }
            });
            return false;
        });
        $('.uploadImg').selectImages({
            confirm:function(res,elem,data) {
                $('#' + data.field).val(res[0].src);
                $('.' + data.field).attr('src',res[0].src)
            }
        });
    });
</script>
{/block}
